]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Use arrow functions for tweener callbacks
authorFlorian Müllner <fmuellner@gnome.org>
Sat, 29 Jun 2019 15:37:59 +0000 (17:37 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 2 Jul 2019 12:17:46 +0000 (12:17 +0000)
While it is legal to use method syntax for the function properties
here, arrow notation is less unexpected and allows us to drop the
separate scope properties.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/608

js/gdm/authPrompt.js
js/gdm/loginDialog.js
js/ui/dnd.js
js/ui/messageList.js
js/ui/panel.js
js/ui/pointerA11yTimeout.js
js/ui/popupMenu.js
js/ui/ripples.js
js/ui/screenShield.js
js/ui/workspaceSwitcherPopup.js
js/ui/workspaceThumbnail.js

index d4cc9f06db6c917ec943c3d7f54d24587bde163a..48135e920eed196782fa0cdad4bd2089f4e39a11 100644 (file)
@@ -295,8 +295,7 @@ var AuthPrompt = class {
                                    time: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
                                    delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
                                    transition: 'linear',
-                                   onCompleteScope: this,
-                                   onComplete() {
+                                   onComplete: () => {
                                       if (wasSpinner) {
                                           if (this._spinner)
                                               this._spinner.stop();
index 7f3c7ed97a1aea2c7ab3c66b08c058163247db91..94cd3460a8f967a3684a6278a7adfeaa0f04e0d1 100644 (file)
@@ -913,7 +913,7 @@ var LoginDialog = GObject.registerClass({
                          { opacity: 255,
                            time: _FADE_ANIMATION_TIME,
                            transition: 'easeOutQuad',
-                           onUpdate() {
+                           onUpdate: () => {
                                let children = Main.layoutManager.uiGroup.get_children();
 
                                for (let i = 0; i < children.length; i++) {
@@ -921,12 +921,10 @@ var LoginDialog = GObject.registerClass({
                                        children[i].opacity = this.opacity;
                                }
                            },
-                           onUpdateScope: this,
-                           onComplete() {
+                           onComplete: () => {
                                if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
                                    this._authPrompt.reset();
-                           },
-                           onCompleteScope: this });
+                           } });
     }
 
     _gotGreeterSessionProxy(proxy) {
@@ -943,7 +941,7 @@ var LoginDialog = GObject.registerClass({
                          { opacity: 0,
                            time: _FADE_ANIMATION_TIME,
                            transition: 'easeOutQuad',
-                           onUpdate() {
+                           onUpdate: () => {
                                let children = Main.layoutManager.uiGroup.get_children();
 
                                for (let i = 0; i < children.length; i++) {
@@ -951,11 +949,9 @@ var LoginDialog = GObject.registerClass({
                                        children[i].opacity = this.opacity;
                                }
                            },
-                           onUpdateScope: this,
-                           onComplete() {
+                           onComplete: () => {
                                this._greeter.call_start_session_when_ready_sync(serviceName, true, null);
-                           },
-                           onCompleteScope: this });
+                           } });
     }
 
     _onSessionOpened(client, serviceName) {
index e53de0b44cf33b0be00c1a7e507134f25a2b16ae..b5e4d1a5a6a04cbfb8c931f174eeab5f3360bd2c 100644 (file)
@@ -434,14 +434,13 @@ var _Draggable = class _Draggable {
                                    scale_y: scale * origScale,
                                    time: SCALE_ANIMATION_TIME,
                                    transition: 'easeOutQuad',
-                                   onUpdate() {
+                                   onUpdate: () => {
                                        let currentScale = this._dragActor.scale_x / origScale;
                                        this._dragOffsetX = currentScale * origDragOffsetX;
                                        this._dragOffsetY = currentScale * origDragOffsetY;
                                        this._dragActor.set_position(this._dragX + this._dragOffsetX,
                                                                     this._dragY + this._dragOffsetY);
-                                   },
-                                   onUpdateScope: this });
+                                   } });
             }
         }
     }
index 34a11066ef1779f74dae099a1872fd6ad804f235..3aaf73f672de8ff78ab87e9253abb87ba0a41589 100644 (file)
@@ -469,8 +469,7 @@ var Message = class Message {
                              { scale_y: 0,
                                time: MessageTray.ANIMATION_TIME,
                                transition: 'easeOutQuad',
-                               onCompleteScope: this,
-                               onComplete() {
+                               onComplete: () => {
                                    this._actionBin.hide();
                                    this.expanded = false;
                                } });
index ed25959adf0574c3c2abc8fb6c8516256f05e8f2..cf8b64fe47792ec7f83eeaba6a926bf4c590cb9d 100644 (file)
@@ -283,10 +283,9 @@ var AppMenuButton = GObject.registerClass({
                          { opacity: 0,
                            time: Overview.ANIMATION_TIME,
                            transition: 'easeOutQuad',
-                           onComplete() {
+                           onComplete: () => {
                                this.hide();
-                           },
-                           onCompleteScope: this });
+                           } });
     }
 
     _onStyleChanged(actor) {
@@ -328,8 +327,7 @@ var AppMenuButton = GObject.registerClass({
                          { opacity: 0,
                            time: SPINNER_ANIMATION_TIME,
                            transition: "easeOutQuad",
-                           onCompleteScope: this,
-                           onComplete() {
+                           onComplete: () => {
                                this._spinner.stop();
                                this._spinner.actor.opacity = 255;
                                this._spinner.actor.hide();
index 617555eb79d61022cfbc5414f27df4b8f6097710..a293a4043163e65b949afc742e234db62f6c6079 100644 (file)
@@ -66,10 +66,8 @@ class PieTimer extends St.DrawingArea {
                          { opacity: 255,
                            time: duration / 1000,
                            transition: 'easeOutQuad',
-                           onUpdateScope: this,
-                           onUpdate() { this.queue_repaint(); },
-                           onCompleteScope: this,
-                           onComplete() { this.stop(); }
+                           onUpdate: () => this.queue_repaint(),
+                           onComplete: () => this.stop()
                           });
     }
 
index 1d3be68ba6e08a6f4f8fd15e161ccf8b4c28a640..fd410b0fd226307b5d2a67c4a7fd62f4990d697f 100644 (file)
@@ -1015,12 +1015,10 @@ var PopupSubMenu = class extends PopupMenuBase {
                              { _arrowRotation: targetAngle,
                                height: naturalHeight,
                                time: 0.25,
-                               onUpdateScope: this,
-                               onUpdate() {
+                               onUpdate: () => {
                                    this._arrow.rotation_angle_z = this.actor._arrowRotation;
                                },
-                               onCompleteScope: this,
-                               onComplete() {
+                               onComplete: () => {
                                    this.actor.set_height(-1);
                                }
                              });
@@ -1048,12 +1046,10 @@ var PopupSubMenu = class extends PopupMenuBase {
                              { _arrowRotation: 0,
                                height: 0,
                                time: 0.25,
-                               onUpdateScope: this,
-                               onUpdate() {
+                               onUpdate: () => {
                                    this._arrow.rotation_angle_z = this.actor._arrowRotation;
                                },
-                               onCompleteScope: this,
-                               onComplete() {
+                               onComplete: () => {
                                    this.actor.hide();
                                    this.actor.set_height(-1);
                                },
index 58e3fa13db0cb43847893d88680d0aad77417226..d478b05a97566fbc9e56bbb69144c281120b667f 100644 (file)
@@ -56,8 +56,8 @@ var Ripples = class Ripples {
                                    delay: delay,
                                    time: time,
                                    transition: 'linear',
-                                   onUpdate() { ripple.opacity = 255 * Math.sqrt(ripple._opacity); },
-                                   onComplete() { ripple.visible = false; } });
+                                   onUpdate: () => ripple.opacity = 255 * Math.sqrt(ripple._opacity),
+                                   onComplete: () => ripple.visible = false });
     }
 
     addTo(stage) {
index e80e0316dcf703dacfad05d8759b1949bf065b30..d407f4f424370115113ce08c36d76cd9704ba811 100644 (file)
@@ -255,11 +255,10 @@ var NotificationsBox = class {
                              { height: natHeight,
                                transition: 'easeOutQuad',
                                time: 0.25,
-                               onComplete() {
+                               onComplete: () => {
                                    this._scrollView.vscrollbar_policy = St.PolicyType.AUTOMATIC;
                                    widget.set_height(-1);
-                               },
-                               onCompleteScope: this
+                               }
                              });
 
             this._updateVisibility();
@@ -791,11 +790,10 @@ var ScreenShield = class {
                              { y: 0,
                                time: time,
                                transition: 'easeInQuad',
-                               onComplete() {
+                               onComplete: () => {
                                    this._lockScreenGroup.fixed_position_set = false;
                                    this._lockScreenState = MessageTray.State.SHOWN;
-                               },
-                               onCompleteScope: this,
+                               }
                              });
 
             this._maybeCancelDialog();
@@ -1008,11 +1006,10 @@ var ScreenShield = class {
                              { y: 0,
                                time: MANUAL_FADE_TIME,
                                transition: 'easeOutQuad',
-                               onComplete() {
+                               onComplete: () => {
                                    this._lockScreenShown({ fadeToBlack: fadeToBlack,
                                                            animateFade: true });
-                               },
-                               onCompleteScope: this
+                               }
                              });
         } else {
             this._lockScreenGroup.fixed_position_set = false;
index 6052ef289c818eeaadea0c2329f91dee96bf0de4..44fab23fb8d82aa21db1e444fe7b1917a35f8d0d 100644 (file)
@@ -161,8 +161,7 @@ class WorkspaceSwitcherPopup extends St.Widget {
         Tweener.addTween(this._container, { opacity: 0.0,
                                             time: ANIMATION_TIME,
                                             transition: 'easeOutQuad',
-                                            onComplete() { this.destroy(); },
-                                            onCompleteScope: this
+                                            onComplete: () => this.destroy()
                                            });
         return GLib.SOURCE_REMOVE;
     }
index 8d23518f4e43141a9d200eda4a57902ec00a3d2d..43fe96363f2896e141af74f556db7d735d68749f 100644 (file)
@@ -1318,11 +1318,10 @@ class ThumbnailsBox extends St.Widget {
                          { indicatorY: thumbnail.actor.allocation.y1,
                            time: WorkspacesView.WORKSPACE_SWITCH_TIME,
                            transition: 'easeOutQuad',
-                           onComplete() {
+                           onComplete: () => {
                                this._animatingIndicator = false;
                                this._queueUpdateStates();
-                           },
-                           onCompleteScope: this
+                           }
                          });
     }
 });